<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Vixcity</title><meta name="author" content="Vixcity"><meta name="copyright" content="Vixcity"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta property="og:type" content="website">
<meta property="og:title" content="Vixcity">
<meta property="og:url" content="http://vixcity.gitee.io/my-gitee-blog/page/3/index.html">
<meta property="og:site_name" content="Vixcity">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://vixcity.gitee.io/my-gitee-blog/img/avatar.png">
<meta property="article:author" content="Vixcity">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://vixcity.gitee.io/my-gitee-blog/img/avatar.png"><link rel="shortcut icon" href="/my-gitee-blog/img/favicon.ico"><link rel="canonical" href="http://vixcity.gitee.io/my-gitee-blog/page/3/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//fonts.googleapis.com" crossorigin=""/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/my-gitee-blog/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium+Web&amp;display=swap" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/my-gitee-blog/',
  algolia: undefined,
  localSearch: {"path":"/my-gitee-blog/search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: {"defaultEncoding":1,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"简"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: '/my-gitee-blog/',
      css: '/my-gitee-blog/'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'Vixcity',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2022-07-15 09:29:35'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="/my-gitee-blog/css/mycss.css"><link rel="stylesheet" href="/my-gitee-blog/css/newStyle.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome-animation@1.1.1/css/font-awesome-animation.css"><link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-card-history/baiduhistory/css/main.css"><!-- hexo injector head_end start --><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/hexo-electric-clock@1.0.6/clock.css"><link rel="stylesheet" href="https://unpkg.zhimg.com/hexo-butterfly-wowjs/lib/animate.min.css" media="print" onload="this.media='screen'"><!-- hexo injector head_end end --><meta name="generator" content="Hexo 5.4.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/my-gitee-blog/img/avatar.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/my-gitee-blog/archives/"><div class="headline">文章</div><div class="length-num">55</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/my-gitee-blog/tags/"><div class="headline">标签</div><div class="length-num">50</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/my-gitee-blog/categories/"><div class="headline">分类</div><div class="length-num">18</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/my-gitee-blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/PicBed"><i class="fa-fw fas fa-image"></i><span> 图库</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('/my-gitee-blog/img/%E5%A4%A7%E5%9C%B0%E7%90%83%E8%83%8C%E6%99%AF.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/my-gitee-blog/">Vixcity</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/my-gitee-blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/PicBed"><i class="fa-fw fas fa-image"></i><span> 图库</span></a></div><div class="menus_item"><a class="site-page" href="/my-gitee-blog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">Vixcity</h1><div id="site-subtitle"><span id="subtitle"></span></div><div id="site_social_icons"><a class="social-icon" href="https://github.com/Vixcity" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:2091283625@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="smallVerse"><i class="fa fa-heart faa-wrench animated" aria-hidden="true"></i><div class="ml20">最是人间留不住，朱颜辞镜花辞树</div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/09/30/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E6%95%B0%E5%AD%97%E7%AF%87/" title="【一行代码可以实现的事】数字篇"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【一行代码可以实现的事】数字篇"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/30/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E6%95%B0%E5%AD%97%E7%AF%87/" title="【一行代码可以实现的事】数字篇">【一行代码可以实现的事】数字篇</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-29T16:00:00.000Z" title="发表于 2021-09-30 00:00:00">2021-09-30</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span></div><div class="content">【一行代码可以实现的事】数字篇为数字添加序数后缀12345678910111213141516171819// `n` is a position numberconst addOrdinal = n =&gt; `$&#123;n&#125;$&#123;[&#x27;st&#x27;, &#x27;nd&#x27;, &#x27;rd&#x27;][((n + 90) % 100 - 10) % 10 - 1] || &#x27;th&#x27;&#125;`;// Orconst addOrdinal = n =&gt; `$&#123;n&#125;$&#123;[, &#x27;st&#x27;, &#x27;nd&#x27;, &#x27;rd&#x27;][/1?.$/.exec(n)] || &#x27;th&#x27;&#125;`;// Orconst addOrdinal = n =&gt; `$&#123;n&#125;$&#123;[, &#x27;st&#x27;, &#x27;nd&#x27;, &#x27;rd&#x27;][n % 100 &gt;&g ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/09/30/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E5%AF%B9%E8%B1%A1%E7%AF%87/" title="【一行代码可以实现的事】对象篇"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【一行代码可以实现的事】对象篇"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/30/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E5%AF%B9%E8%B1%A1%E7%AF%87/" title="【一行代码可以实现的事】对象篇">【一行代码可以实现的事】对象篇</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-29T16:00:00.000Z" title="发表于 2021-09-30 00:00:00">2021-09-30</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E5%AF%B9%E8%B1%A1/">对象</a></span></div><div class="content">【一行代码可以实现的事】对象篇检查多个对象是否相等12345const isEqual = (...objects) =&gt; objects.every(obj =&gt; JSON.stringify(obj) === JSON.stringify(objects[0]));// ExamplesisEqual(&#123; foo: &#x27;bar&#x27; &#125;, &#123; foo: &#x27;bar&#x27; &#125;);    // trueisEqual(&#123; foo: &#x27;bar&#x27; &#125;, &#123; bar: &#x27;foo&#x27; &#125;);    // false

创建一个没有属性的空map12345// `map` doesn&#x27;t have any propertiesconst map = Object.create(null);// The following `map` has `__proto__` property// const map = &#123;&#12 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/09/29/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E5%85%B6%E4%BB%96%E7%AF%87/" title="【一行代码可以实现的事】其他篇"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【一行代码可以实现的事】其他篇"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/29/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E5%85%B6%E4%BB%96%E7%AF%87/" title="【一行代码可以实现的事】其他篇">【一行代码可以实现的事】其他篇</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-28T16:00:00.000Z" title="发表于 2021-09-29 00:00:00">2021-09-29</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span></div><div class="content">【一行代码可以实现的事】其他篇检查代码是否在 NodeJS 中运行1const isNode = typeof process !== &#x27;undefined&#x27; &amp;&amp; process.versions != null &amp;&amp; process.versions.node != null;

检查代码是否在浏览器中运行1const isBrowser = typeof window === &#x27;object&#x27; &amp;&amp; typeof document === &#x27;object&#x27;;

清除所有 cookie1const clearCookies = document.cookie.split(&#x27;;&#x27;).forEach(c =&gt; document.cookie = c.replace(/^ +/, &#x27;&#x27;).replace(/=.*/, `=;expires=$&#123;new Date().toUTCString()&#125;;path=/`));
 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/09/29/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E6%95%B0%E5%AD%A6%E7%AF%87/" title="【一行代码可以实现的事】数学篇"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【一行代码可以实现的事】数学篇"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/29/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E6%95%B0%E5%AD%A6%E7%AF%87/" title="【一行代码可以实现的事】数学篇">【一行代码可以实现的事】数学篇</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-28T16:00:00.000Z" title="发表于 2021-09-29 00:00:00">2021-09-29</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span></div><div class="content">【一行代码可以实现的事】数学篇计算由两点定义的直线的角度12345// In radiansconst radiansAngle = (p1, p2) =&gt; Math.atan2(p2.y - p1.y, p2.x - p1.x);// In degreesconst degreesAngle = (p1, p2) =&gt; Math.atan2(p2.y - p1.y, p2.x - p1.x) * 180 / Math.PI;

计算两点之间的距离1const distance = (p1, p2) =&gt; Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));

计算两个数字之间的线性插值1const lerp = (a, b, amount) =&gt; (1 - amount) * a + amount * b;

计算两点之间的中点1const midpoint = (p1, p2) =&gt; [(p1.x + p2.x) / 2, (p1.y + p2.y) / 2];

检查点是否在矩 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/09/28/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E5%87%BD%E6%95%B0%E7%AF%87/" title="【一行代码可以实现的事】函数篇"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【一行代码可以实现的事】函数篇"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/28/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E5%87%BD%E6%95%B0%E7%AF%87/" title="【一行代码可以实现的事】函数篇">【一行代码可以实现的事】函数篇</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-27T16:00:00.000Z" title="发表于 2021-09-28 00:00:00">2021-09-28</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E5%87%BD%E6%95%B0/">-函数</a></span></div><div class="content">【一行代码可以实现的事】函数篇箱子处理程序12345678910111213const boxHandler = x =&gt; (&#123; next: f =&gt; boxHandler(f(x)), done: f =&gt; f(x) &#125;);// Example 1const getPercentNumber = str =&gt; boxHandler(str).next(str =&gt; str.replace(/\%/, &#x27;&#x27;)).next(str =&gt; parseFloat(str)).done(res =&gt; res * 0.01);getPercentNumber(&#x27;50%&#x27;);    // 0.5// Example 2const getMoney = (price) =&gt; Number.parseFloat(price.replace(/\$/, &#x27;&#x27;));const getPercent = (percent) =&gt; Number.parseFloat(perce ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/09/27/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E6%97%A5%E6%9C%9F%E6%97%B6%E9%97%B4%E7%AF%87/" title="【一行代码可以实现的事】时间日期篇"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【一行代码可以实现的事】时间日期篇"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/27/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E6%97%A5%E6%9C%9F%E6%97%B6%E9%97%B4%E7%AF%87/" title="【一行代码可以实现的事】时间日期篇">【一行代码可以实现的事】时间日期篇</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-26T16:00:00.000Z" title="发表于 2021-09-27 00:00:00">2021-09-27</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E6%97%A5%E6%9C%9F%E6%97%B6%E9%97%B4/">日期时间</a></span></div><div class="content">【一行代码可以实现的事】时间日期篇将24小时制转成12小时制并添加后缀 AM PM123456789// `h` is an hour number between 0 and 23const suffixAmPm = h =&gt; `$&#123;h % 12 === 0 ? 12 : h % 12&#125;$&#123;h &lt; 12 ? &#x27;am&#x27; : &#x27;pm&#x27;&#125;`;// ExamplessuffixAmPm(0);      // &#x27;12am&#x27;suffixAmPm(5);      // &#x27;5am&#x27;suffixAmPm(12);     // &#x27;12pm&#x27;suffixAmPm(15);     // &#x27;3pm&#x27;suffixAmPm(23);     // &#x27;11pm&#x27;

计算两个日期之间的差异天数1234const diffDays = (date, otherDate) =&gt; Math.ceil(Math.abs(d ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/09/26/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91DOM%E8%8A%82%E7%82%B9%E7%AF%87/" title="【一行代码可以实现的事】DOM节点篇"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【一行代码可以实现的事】DOM节点篇"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/26/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91DOM%E8%8A%82%E7%82%B9%E7%AF%87/" title="【一行代码可以实现的事】DOM节点篇">【一行代码可以实现的事】DOM节点篇</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-25T16:00:00.000Z" title="发表于 2021-09-26 00:00:00">2021-09-26</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/DOM%E8%8A%82%E7%82%B9/">DOM节点</a></span></div><div class="content">【一行代码可以实现的事】DOM节点篇检查一个元素是否是另一个元素的后代1const isDescendant = (child, parent) =&gt; parent.contains(child);

检查元素是否被聚焦1const hasFocus = ele =&gt; (ele === document.activeElement);

检查是否支持触摸事件1const touchSupported = () =&gt; (&#x27;ontouchstart&#x27; in window || window.DocumentTouch &amp;&amp; document instanceof window.DocumentTouch);

检查用户是否滚动到页面底部1const isAtBottom = () =&gt; document.documentElement.clientHeight + window.scrollY &gt;= document.documentElement.scrollHeight;

检测 Internet Explorer 浏览 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/09/23/%E3%80%90HTML%E3%80%91%E5%A6%82%E4%BD%95%E8%AE%BE%E7%BD%AEDIV%E5%8F%AF%E7%BC%96%E8%BE%91/" title="【HTML】如何设置DIV可编辑"><img class="post_bg" src="/my-gitee-blog/img/HTML.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【HTML】如何设置DIV可编辑"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/23/%E3%80%90HTML%E3%80%91%E5%A6%82%E4%BD%95%E8%AE%BE%E7%BD%AEDIV%E5%8F%AF%E7%BC%96%E8%BE%91/" title="【HTML】如何设置DIV可编辑">【HTML】如何设置DIV可编辑</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-22T16:00:00.000Z" title="发表于 2021-09-23 00:00:00">2021-09-23</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/HTML/">HTML</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/HTML/">HTML</a></span></div><div class="content">【HTML】如何设置 DIV 可编辑如何让一个 div 变成可编辑状态，比如富文本的输入框就可以用可编辑的 div（自定义一个富文本时可用），类似 textare。
有 2 种方案可以实现：1 是通过 contenteditable 属性设置为 true，2 是利用 css 的 user-modify 属性。
方案一：contenteditable 属性1&lt;div id=&quot;add-content&quot; contenteditable=&quot;true&quot;&gt;这里可以编辑&lt;/div&gt;

contenteditable 属性是 html5 中的新属性，contenteditable 属性规定元素内容是否可编辑。
注释：如果元素未设置 contenteditable 属性，那么元素会从其父元素继承该属性。
js 操作：
监听事件 keydown 、textInput 、input
1234567891011121314151617181920212223242526272829303132333435363738394041424344454 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/09/23/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E6%95%B0%E7%BB%84%E7%AF%87/" title="【一行代码可以实现的事】数组篇"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【一行代码可以实现的事】数组篇"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/23/%E3%80%90%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81%E5%8F%AF%E4%BB%A5%E5%AE%9E%E7%8E%B0%E7%9A%84%E4%BA%8B%E3%80%91%E6%95%B0%E7%BB%84%E7%AF%87/" title="【一行代码可以实现的事】数组篇">【一行代码可以实现的事】数组篇</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-22T16:00:00.000Z" title="发表于 2021-09-23 00:00:00">2021-09-23</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/">一行代码</a></span></div><div class="content">【一行代码可以实现的事】数组篇将值转换为数组12345const castArray = value =&gt; Array.isArray(value) ? value : [value];// ExamplecastArray(1);               // [1]castArray([1, 2, 3]);       // [1, 2, 3]

检查数组是否为空123456// `arr` is an arrayconst isEmpty = arr =&gt; !Array.isArray(arr) || arr.length === 0;// ExamplesisEmpty([]);            // trueisEmpty([1, 2, 3]);     // false

克隆一个数组1234567891011121314151617// `arr` is an arrayconst clone = arr =&gt; arr.slice(0);// Orconst clone = arr =&gt; [...arr];// Orconst clone ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/09/22/%E3%80%90CSS%E3%80%91%E5%AE%9E%E7%8E%B0%E6%96%B0%E6%8B%9F%E6%80%81(Neumorphism)%20UI%20%E9%A3%8E%E6%A0%BC/" title="【CSS】实现新拟态(Neumorphism) UI 风格"><img class="post_bg" src="/my-gitee-blog/img/CSS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【CSS】实现新拟态(Neumorphism) UI 风格"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/22/%E3%80%90CSS%E3%80%91%E5%AE%9E%E7%8E%B0%E6%96%B0%E6%8B%9F%E6%80%81(Neumorphism)%20UI%20%E9%A3%8E%E6%A0%BC/" title="【CSS】实现新拟态(Neumorphism) UI 风格">【CSS】实现新拟态(Neumorphism) UI 风格</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-21T16:00:00.000Z" title="发表于 2021-09-22 00:00:00">2021-09-22</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/">CSS</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/CSS/">CSS</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E6%8B%9F%E6%80%81/">拟态</a></span></div><div class="content">【CSS】实现新拟态(Neumorphism) UI 风格新拟态是一种图形样式，其原理是为界面的UI元素赋予真实感。
原生名词有几个叫法，Neumorphism / soft ui，翻译过来是新拟态或者是软ui。
国内的翻译叫，新拟物风格。
Neumorphism，是New +Skeuomorphism的组合词。
按照我个人的通俗理解，就是将界面的一部分凸起来，另一部分凹下去，通过光影形成的一种错落有致的拟物风格。
让人感到真实一种UI风格。
代表作是乌克兰设计师 Alexander Plyuto 在各平台发布的新作品「Skeuomorph Mobile Banking」
  
新拟态 UI 风格与扁平、投影风格的对比
  
从上面这张对比图可以看出，扁平风格就像是一张纸贴在墙面上，投影风格像是浮在半空中，而新拟态风格则像是墙面上直接凸起了一块。
要实现这种风格，精髓在于一个白色的阴影+一个常规阴影。一个示例如下图所示：
  
新拟态 UI 风格的前端实现闲来无事，参照着以上的实现方式临摹了一下练手(代码如下)。后来发现居然已经有了在线工具直接生成这种风格的 css 代码[aru_59 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/09/18/%E3%80%90JavaScript%E3%80%91%E8%8A%B1%E9%87%8C%E8%83%A1%E5%93%A8%E7%9A%84%20JS%20%E8%A3%85%E9%80%BC%E5%A4%A7%E6%B3%95%EF%BC%8C%E7%9B%B4%E5%91%BC%E5%86%85%E8%A1%8C/" title="【JavaScript】花里胡哨的 JS 装逼大法，直呼内行"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【JavaScript】花里胡哨的 JS 装逼大法，直呼内行"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/18/%E3%80%90JavaScript%E3%80%91%E8%8A%B1%E9%87%8C%E8%83%A1%E5%93%A8%E7%9A%84%20JS%20%E8%A3%85%E9%80%BC%E5%A4%A7%E6%B3%95%EF%BC%8C%E7%9B%B4%E5%91%BC%E5%86%85%E8%A1%8C/" title="【JavaScript】花里胡哨的 JS 装逼大法，直呼内行">【JavaScript】花里胡哨的 JS 装逼大法，直呼内行</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-17T16:00:00.000Z" title="发表于 2021-09-18 00:00:00">2021-09-18</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/JavaScript/">JavaScript</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a></span></div><div class="content">【JavaScript】花里胡哨的 JS 装逼大法，直呼内行1、最简单的单行评级组件1&quot;★★★★★☆☆☆☆☆&quot;.slice(5 - rate, 10 - rate);

定义一个变量 rate 是 1 到 5 的值，然后执行上面代码，如下：

这才发现其他插件都弱爆了呀！
2、JS 错误处理的方式的正确姿势（直接定位错误原因）123456try &#123; // something&#125; catch (e) &#123; // 直接去 stackoverflow 去搜索哈哈哈 window.location.href =&quot;http://stackoverflow.com/search?q=[js]+&quot;+e.message;&#125;

3、从一行代码里面学点 JavaScript（如何快速知道所有元素边框）12345678[].forEach.call( // 获取所有元素 $$(&quot;*&quot;), function(a)&#123;  // 给他们加上外边框  a.style.outline=&quot;1px solid ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/09/17/%E3%80%90JavaScript%E3%80%9110%E4%B8%AA%E6%B8%85%E6%99%B0%E5%AE%9E%E7%94%A8%E6%9B%B4%E6%98%BE%E4%B8%93%E4%B8%9A%E7%9A%84JavaScript%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/" title="【JavaScript】10个清晰实用更显专业的JavaScript代码片段"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【JavaScript】10个清晰实用更显专业的JavaScript代码片段"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/17/%E3%80%90JavaScript%E3%80%9110%E4%B8%AA%E6%B8%85%E6%99%B0%E5%AE%9E%E7%94%A8%E6%9B%B4%E6%98%BE%E4%B8%93%E4%B8%9A%E7%9A%84JavaScript%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/" title="【JavaScript】10个清晰实用更显专业的JavaScript代码片段">【JavaScript】10个清晰实用更显专业的JavaScript代码片段</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-16T16:00:00.000Z" title="发表于 2021-09-17 00:00:00">2021-09-17</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/JavaScript/">JavaScript</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JS%E5%BA%93/">JS库</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/ES6/">ES6</a></span></div><div class="content">【JavaScript】10个清晰实用更显专业的JavaScript代码片段这是一些非常酷，非常有用的速记代码片段
使用这些代码片段，可以使你的代码看起来更加的专业
1、单行If-Else语句(三元表达式)我们最常用的可能是这样的if-else语句：
12345if (10 &lt; 100) &#123; console.log(&quot;true&quot;);&#125; else &#123; console.log(&quot;false&quot;);&#125;  

输出
1true  

我们可以通过使用三元表达式，用更简洁的方式来重新编写上面的代码
110 &lt;100 ？console.log（“true”）：console.log（“false”）  

输出：
1true  

通常，三元运算符遵循以下简单模式：
1条件 ? 为真时候的表达式 : 为假时候的表达式

三元运算符也可以链接在一起以形成更长的链。但是，它通常会使代码变得很冗长。明智地使用它们，不会使事情变得更复杂。
2、合并数组(扩展运算符)我们在平常使用中可能需要合并两个数组
那么这个时候我 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/09/16/%E3%80%90CSS%E3%80%91%E5%A6%99%E7%94%A8%20background%20%E5%AE%9E%E7%8E%B0%E8%8A%B1%E5%BC%8F%E6%96%87%E5%AD%97%E6%95%88%E6%9E%9C/" title="【CSS杂谈】妙用 background 实现花式文字效果"><img class="post_bg" src="/my-gitee-blog/img/CSS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【CSS杂谈】妙用 background 实现花式文字效果"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/16/%E3%80%90CSS%E3%80%91%E5%A6%99%E7%94%A8%20background%20%E5%AE%9E%E7%8E%B0%E8%8A%B1%E5%BC%8F%E6%96%87%E5%AD%97%E6%95%88%E6%9E%9C/" title="【CSS杂谈】妙用 background 实现花式文字效果">【CSS杂谈】妙用 background 实现花式文字效果</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-15T16:00:00.000Z" title="发表于 2021-09-16 00:00:00">2021-09-16</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/">CSS</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/CSS/">CSS</a></span></div><div class="content">【CSS杂谈】妙用 background 实现花式文字效果Hello 大家好，我是 Vixcity。本文将讲解如何利用 background 系列属性，巧妙的实现一些花式的文字效果。通过本文，你将可以学到：

通过 background-size 与 background-position 实现酷炫的文字下划线效果
通过 background-size 与 background-position 以及 background-clip 实现文字逐个渐现的效果

起因写本文的动机是在于，某天，被这样一个标题所吸引 – 10 Masterfully Designed Websites，其中列举了 10 个极具创意的 Web 网站
其中一个 Red Bull Racing 网站，是介绍关于 F1 红牛车队的主页。其中有这样一个非常有意思的 Hover 动画效果：

这个文字的 hover 出现效果，看似简单，其实想要完全实现它，仅仅依靠 CSS 是非常复杂的
其中一个比较难的地方在于 – 如何让一个效果，逐渐作用给整段文字中的部分
而不是一次将整个效果赋予整段文本
利用 background  ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/09/15/%E3%80%90JavaScript%E3%80%91%E5%87%A0%E4%B8%AAJavaScript%E6%9E%81%E7%9F%AD%E6%97%A5%E6%9C%9F%E6%97%B6%E9%97%B4%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5%EF%BC%88%E4%BD%A0%E5%80%BC%E5%BE%97%E6%8B%A5%E6%9C%89%EF%BC%89/" title="【JavaScript】几个JavaScript极短日期时间代码片段（你值得拥有）"><img class="post_bg" src="/my-gitee-blog/img/JS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【JavaScript】几个JavaScript极短日期时间代码片段（你值得拥有）"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/15/%E3%80%90JavaScript%E3%80%91%E5%87%A0%E4%B8%AAJavaScript%E6%9E%81%E7%9F%AD%E6%97%A5%E6%9C%9F%E6%97%B6%E9%97%B4%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5%EF%BC%88%E4%BD%A0%E5%80%BC%E5%BE%97%E6%8B%A5%E6%9C%89%EF%BC%89/" title="【JavaScript】几个JavaScript极短日期时间代码片段（你值得拥有）">【JavaScript】几个JavaScript极短日期时间代码片段（你值得拥有）</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-14T16:00:00.000Z" title="发表于 2021-09-15 00:00:00">2021-09-15</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/JavaScript/">JavaScript</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/">代码片段</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JS%E5%BA%93/">JS库</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/JavaScript/">JavaScript</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/%E6%97%B6%E9%97%B4%E6%97%A5%E6%9C%9F/">时间日期</a></span></div><div class="content">几个JavaScript极短日期时间代码片段（你值得拥有）前言
本篇文章主打极短的日期时间相关代码片段，让你不用工具库也能秀的飞起

是否今天日期是不是今天，我们只需要判断 日期的 年月日 是否与 当前日期的 年月日一致即可，所以我们的常规代码片段如下：
1234567function isToday(dt = new Date()) &#123;    let curDate = new Date() // 当前日期     let comparedDate= new Date(typeof dt === &#x27;string&#x27;&amp;&amp;dt.includes(&#x27;-&#x27;)?dt.replace(/-/g,&#x27;/&#x27;):dt) // 传入日期    return curDate.getFullYear() === comparedDate.getFullYear() &amp;&amp; // 年相等           curDate.getMonth() === comparedDate.getMonth() &amp;&a ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/my-gitee-blog/2021/09/14/%E3%80%90%E6%BA%90%E7%A0%81%E9%98%85%E8%AF%BB%E3%80%91%E6%89%8B%E6%91%B8%E6%89%8B%E6%95%99%E4%BD%A0%E8%B0%83%E8%AF%95%20vue-devtools%20%EF%BC%8C%E4%BD%A0%E7%A1%AE%E5%AE%9A%E4%B8%8D%E6%9D%A5%E7%9C%8B%E7%9C%8B%E5%98%9B/" title="【源码阅读】手摸手教你调试 vue-devtools ，你确定不来看看嘛"><img class="post_bg" src="/my-gitee-blog/img/vue%E7%9B%B8%E5%85%B3.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【源码阅读】手摸手教你调试 vue-devtools ，你确定不来看看嘛"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/14/%E3%80%90%E6%BA%90%E7%A0%81%E9%98%85%E8%AF%BB%E3%80%91%E6%89%8B%E6%91%B8%E6%89%8B%E6%95%99%E4%BD%A0%E8%B0%83%E8%AF%95%20vue-devtools%20%EF%BC%8C%E4%BD%A0%E7%A1%AE%E5%AE%9A%E4%B8%8D%E6%9D%A5%E7%9C%8B%E7%9C%8B%E5%98%9B/" title="【源码阅读】手摸手教你调试 vue-devtools ，你确定不来看看嘛">【源码阅读】手摸手教你调试 vue-devtools ，你确定不来看看嘛</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-13T16:00:00.000Z" title="发表于 2021-09-14 00:00:00">2021-09-14</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E6%BA%90%E7%A0%81/">源码</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/%E6%BA%90%E7%A0%81/">源码</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/Vue-devtools/">Vue-devtools</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/my-gitee-blog/tags/Vue/">Vue</a></span></div><div class="content">【源码阅读】手摸手教你调试 vue-devtools ，你确定不来看看嘛准备过程今天我又来看源码了，今天来看 vue-devtools 的源码
我们来看看 github 上 vue-devtools 的源码
我们看到它的 readme 里面有个 Documentation
这个点进去就是他的官网（PS：现在 vue-devtools 也有官网了）
首先点击右上角的 Gride 或者点击中间的 Get Star 按钮

点击我们会来到这个界面

这个是安装的界面，我们按照界面提示安装一下
因为我们是要研究这个源码的，所以我们继续往下看
点击到这个 Open component in editor（翻译：在编辑器中打开组件）

点开我们可以看到主页面有这么一段话

Vue CLI 3 supports this feature out-of-the-box when running vue-cli-service serve.翻译：在运行“vue-cli-service serve”时，Vue CLI 3支持此功能。

啥意思呢，说人话就是
我们可以在 vue-cli-service se ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/my-gitee-blog/2021/09/13/%E3%80%90CSS%E3%80%91%E5%85%A8%E5%85%BC%E5%AE%B9%E7%9A%84%E6%AF%9B%E7%8E%BB%E7%92%83%E6%95%88%E6%9E%9C/" title="【CSS杂谈】全兼容的毛玻璃效果"><img class="post_bg" src="/my-gitee-blog/img/CSS.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【CSS杂谈】全兼容的毛玻璃效果"></a></div><div class="recent-post-info"><a class="article-title" href="/my-gitee-blog/2021/09/13/%E3%80%90CSS%E3%80%91%E5%85%A8%E5%85%BC%E5%AE%B9%E7%9A%84%E6%AF%9B%E7%8E%BB%E7%92%83%E6%95%88%E6%9E%9C/" title="【CSS杂谈】全兼容的毛玻璃效果">【CSS杂谈】全兼容的毛玻璃效果</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-12T16:00:00.000Z" title="发表于 2021-09-13 00:00:00">2021-09-13</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/">CSS</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/my-gitee-blog/tags/CSS/">CSS</a></span></div><div class="content">【CSS杂谈】全兼容的毛玻璃效果通过本文，你能了解到

最基本的使用 CSS backdrop-filter 实现磨砂玻璃(毛玻璃)的效果
在至今不兼容 backdrop-filter 的 firefox 浏览器，如何利用一些技巧性的操作，巧妙的同样实现毛玻璃效果，让这个效果真正能运用在业务当中

什么是 backdrop-filterbackdrop-filter CSS 属性可以让你为一个元素后面区域添加图形效果（如模糊或颜色偏移）
因为它适用于元素背后的所有元素，为了看到效果，必须使元素或其背景至少部分透明
backdrop-filter 与 filter 非常类似，可以取的值都是一样的
但是一个是作用于整个元素，一个是只作用于元素后面的区域
backdrop-filter 与 filter 对比我们使用 backdrop-filter 与 filter 同时实现一个毛玻璃效果作为对比，伪代码如下：
12345&lt;div class=&quot;bg&quot;&gt;      &lt;div&gt;Normal&lt;/div&gt;      &lt;div class ...</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/my-gitee-blog/page/2/#content-inner"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/my-gitee-blog/">1</a><a class="page-number" href="/my-gitee-blog/page/2/#content-inner">2</a><span class="page-number current">3</span><a class="page-number" href="/my-gitee-blog/page/4/#content-inner">4</a><a class="extend next" rel="next" href="/my-gitee-blog/page/4/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/my-gitee-blog/img/avatar.png" onerror="this.onerror=null;this.src='/my-gitee-blog/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Vixcity</div><div class="author-info__description">今日事，今日毕</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/my-gitee-blog/archives/"><div class="headline">文章</div><div class="length-num">55</div></a></div><div class="card-info-data-item is-center"><a href="/my-gitee-blog/tags/"><div class="headline">标签</div><div class="length-num">50</div></a></div><div class="card-info-data-item is-center"><a href="/my-gitee-blog/categories/"><div class="headline">分类</div><div class="length-num">18</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/Vixcity"><i class="fab fa-github"></i><span>我的Github</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/Vixcity" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:2091283625@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">这是Vixcity目前的小博客</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/my-gitee-blog/2022/07/13/%E3%80%90NodeJS%E3%80%91NodeJS%20%E6%9C%8D%E5%8A%A1%E7%AB%AF%E8%AF%B7%E6%B1%82/" title="【NodeJS】NodeJS 服务端请求"><img src="/my-gitee-blog/img/NodeJs.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【NodeJS】NodeJS 服务端请求"/></a><div class="content"><a class="title" href="/my-gitee-blog/2022/07/13/%E3%80%90NodeJS%E3%80%91NodeJS%20%E6%9C%8D%E5%8A%A1%E7%AB%AF%E8%AF%B7%E6%B1%82/" title="【NodeJS】NodeJS 服务端请求">【NodeJS】NodeJS 服务端请求</a><time datetime="2022-07-12T16:00:00.000Z" title="发表于 2022-07-13 00:00:00">2022-07-13</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/my-gitee-blog/2022/07/12/%E3%80%90Hexo%E3%80%91%E6%A0%87%E7%AD%BE%E6%A0%B7%E5%BC%8F%E5%88%97%E8%A1%A8%E5%8F%82%E8%80%83%20-%201/" title="【Hexo】标签样式列表参考 - 1"><img src="/my-gitee-blog/img/hexo.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【Hexo】标签样式列表参考 - 1"/></a><div class="content"><a class="title" href="/my-gitee-blog/2022/07/12/%E3%80%90Hexo%E3%80%91%E6%A0%87%E7%AD%BE%E6%A0%B7%E5%BC%8F%E5%88%97%E8%A1%A8%E5%8F%82%E8%80%83%20-%201/" title="【Hexo】标签样式列表参考 - 1">【Hexo】标签样式列表参考 - 1</a><time datetime="2022-07-11T16:00:00.000Z" title="发表于 2022-07-12 00:00:00">2022-07-12</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/my-gitee-blog/2022/07/12/%E3%80%90Hexo%E3%80%91%E6%A0%87%E7%AD%BE%E6%A0%B7%E5%BC%8F%E5%88%97%E8%A1%A8%E5%8F%82%E8%80%83%20-%202/" title="【Hexo】标签样式列表参考 - 2"><img src="/my-gitee-blog/img/hexo.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【Hexo】标签样式列表参考 - 2"/></a><div class="content"><a class="title" href="/my-gitee-blog/2022/07/12/%E3%80%90Hexo%E3%80%91%E6%A0%87%E7%AD%BE%E6%A0%B7%E5%BC%8F%E5%88%97%E8%A1%A8%E5%8F%82%E8%80%83%20-%202/" title="【Hexo】标签样式列表参考 - 2">【Hexo】标签样式列表参考 - 2</a><time datetime="2022-07-11T16:00:00.000Z" title="发表于 2022-07-12 00:00:00">2022-07-12</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/my-gitee-blog/2022/07/12/%E3%80%90Hexo%E3%80%91%E6%A0%87%E7%AD%BE%E6%A0%B7%E5%BC%8F%E5%88%97%E8%A1%A8%E5%8F%82%E8%80%83%20-%203/" title="【Hexo】标签样式列表参考 - 3"><img src="/my-gitee-blog/img/hexo.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【Hexo】标签样式列表参考 - 3"/></a><div class="content"><a class="title" href="/my-gitee-blog/2022/07/12/%E3%80%90Hexo%E3%80%91%E6%A0%87%E7%AD%BE%E6%A0%B7%E5%BC%8F%E5%88%97%E8%A1%A8%E5%8F%82%E8%80%83%20-%203/" title="【Hexo】标签样式列表参考 - 3">【Hexo】标签样式列表参考 - 3</a><time datetime="2022-07-11T16:00:00.000Z" title="发表于 2022-07-12 00:00:00">2022-07-12</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/my-gitee-blog/2022/07/07/%E3%80%90NodeJS%E3%80%91NodeJS%E5%85%A5%E9%97%A8%E5%AD%A6%E4%B9%A0/" title="【NodeJS】NodeJS入门学习"><img src="/my-gitee-blog/img/NodeJs.jpg" onerror="this.onerror=null;this.src='/my-gitee-blog/img/404.jpg'" alt="【NodeJS】NodeJS入门学习"/></a><div class="content"><a class="title" href="/my-gitee-blog/2022/07/07/%E3%80%90NodeJS%E3%80%91NodeJS%E5%85%A5%E9%97%A8%E5%AD%A6%E4%B9%A0/" title="【NodeJS】NodeJS入门学习">【NodeJS】NodeJS入门学习</a><time datetime="2022-07-06T16:00:00.000Z" title="发表于 2022-07-07 00:00:00">2022-07-07</time></div></div></div></div><div class="card-widget card-mingpian"><div class="card-content"><div class="item-headline"><i class="fa fa-address-card" aria-hidden="true"></i><span>我的名片</span><iframe src="https://muselink.cc/Vixcity" frameborder="0" style="width:99%;height:800px;margin:0;"></iframe></div></div></div><div class="card-widget card-pixiv"><div class="card-content"><div class="item-headline"><i class="fa fa-image-o" aria-hidden="true"></i><span>Pixiv日榜</span><iframe src="https://cloud.mokeyjay.com/pixiv" frameborder="0" style="width:99%;height:380px;margin:0;"></iframe></div></div></div><div class="card-widget card-history"><div class="card-content"><div class="item-headline"><i class="fas fa-clock fa-spin"></i><span>那年今日</span></div><div id="history-baidu" style="height: 100px;overflow: hidden;"><div class="history_swiper-container" id="history-container" style="width: 100%;height: 100%;"><div class="swiper-wrapper" id="history_container_wrapper" style="height:20px"></div></div></div></div></div><div class="card-widget card-categories"><div class="item-headline">
            <i class="fas fa-folder-open"></i>
            <span>分类</span>
            <a class="card-more-btn" href="/my-gitee-blog/categories/" title="查看更多">
    <i class="fas fa-angle-right"></i></a>
            </div>
            <ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/VS-Code/"><span class="card-category-list-name">VS Code</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/git/"><span class="card-category-list-name">git</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/%E5%8D%9A%E5%AE%A2/"><span class="card-category-list-name">博客</span><span class="card-category-list-count">3</span></a><ul class="card-category-list child"><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/%E5%8D%9A%E5%AE%A2/Hexo/"><span class="card-category-list-name">Hexo</span><span class="card-category-list-count">3</span></a></li></ul></li><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/"><span class="card-category-list-name">大前端</span><span class="card-category-list-count">40</span></a><ul class="card-category-list child"><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/CSS/"><span class="card-category-list-name">CSS</span><span class="card-category-list-count">6</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/HTML/"><span class="card-category-list-name">HTML</span><span class="card-category-list-count">2</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/my-gitee-blog/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/Http/"><span class="card-category-list-name">Http</span><span class="card-category-list-count">2</span></a></li></ul></li>
            </ul></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/my-gitee-blog/tags/CSS/" style="font-size: 1.26em; color: rgb(43, 85, 112)">CSS</a><a href="/my-gitee-blog/tags/%E9%87%8D%E6%9E%84/" style="font-size: 1.15em; color: rgb(146, 148, 48)">重构</a><a href="/my-gitee-blog/tags/%E6%8B%9F%E6%80%81/" style="font-size: 1.15em; color: rgb(127, 142, 119)">拟态</a><a href="/my-gitee-blog/tags/eomji/" style="font-size: 1.15em; color: rgb(17, 36, 81)">eomji</a><a href="/my-gitee-blog/tags/%E5%91%BD%E4%BB%A4%E8%A1%8C/" style="font-size: 1.19em; color: rgb(6, 87, 193)">命令行</a><a href="/my-gitee-blog/tags/HTML/" style="font-size: 1.19em; color: rgb(196, 32, 145)">HTML</a><a href="/my-gitee-blog/tags/Http/" style="font-size: 1.19em; color: rgb(42, 147, 169)">Http</a><a href="/my-gitee-blog/tags/Https/" style="font-size: 1.19em; color: rgb(165, 61, 52)">Https</a><a href="/my-gitee-blog/tags/%E5%8D%8F%E8%AE%AE/" style="font-size: 1.19em; color: rgb(49, 114, 64)">协议</a><a href="/my-gitee-blog/tags/%E8%87%AA%E5%8A%A8%E5%8C%96%E5%8F%91%E5%B8%83/" style="font-size: 1.15em; color: rgb(76, 57, 42)">自动化发布</a><a href="/my-gitee-blog/tags/hexo/" style="font-size: 1.15em; color: rgb(91, 102, 125)">hexo</a><a href="/my-gitee-blog/tags/%E7%BE%8E%E5%8C%96/" style="font-size: 1.22em; color: rgb(128, 142, 62)">美化</a><a href="/my-gitee-blog/tags/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/" style="font-size: 1.22em; color: rgb(124, 188, 55)">技术分享</a><a href="/my-gitee-blog/tags/%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5/" style="font-size: 1.41em; color: rgb(90, 140, 53)">代码片段</a><a href="/my-gitee-blog/tags/JS%E5%BA%93/" style="font-size: 1.19em; color: rgb(152, 38, 170)">JS库</a><a href="/my-gitee-blog/tags/JavaScript/" style="font-size: 1.45em; color: rgb(12, 54, 22)">JavaScript</a><a href="/my-gitee-blog/tags/ES6/" style="font-size: 1.15em; color: rgb(92, 17, 188)">ES6</a><a href="/my-gitee-blog/tags/%E6%97%B6%E9%97%B4%E6%97%A5%E6%9C%9F/" style="font-size: 1.15em; color: rgb(172, 36, 139)">时间日期</a><a href="/my-gitee-blog/tags/%E7%BB%A7%E6%89%BF/" style="font-size: 1.15em; color: rgb(28, 160, 107)">继承</a><a href="/my-gitee-blog/tags/Node/" style="font-size: 1.26em; color: rgb(184, 98, 18)">Node</a><a href="/my-gitee-blog/tags/http/" style="font-size: 1.15em; color: rgb(13, 160, 121)">http</a><a href="/my-gitee-blog/tags/%E6%9C%8D%E5%8A%A1%E5%99%A8/" style="font-size: 1.15em; color: rgb(102, 23, 158)">服务器</a><a href="/my-gitee-blog/tags/TypeScript/" style="font-size: 1.22em; color: rgb(101, 75, 195)">TypeScript</a><a href="/my-gitee-blog/tags/%E4%B8%80%E8%A1%8C%E4%BB%A3%E7%A0%81/" style="font-size: 1.38em; color: rgb(84, 177, 196)">一行代码</a><a href="/my-gitee-blog/tags/DOM%E8%8A%82%E7%82%B9/" style="font-size: 1.15em; color: rgb(164, 155, 169)">DOM节点</a><a href="/my-gitee-blog/tags/%E5%87%BD%E6%95%B0/" style="font-size: 1.15em; color: rgb(181, 174, 37)">-函数</a><a href="/my-gitee-blog/tags/%E5%AD%97%E7%AC%A6%E4%B8%B2/" style="font-size: 1.15em; color: rgb(40, 147, 87)">字符串</a><a href="/my-gitee-blog/tags/%E5%AF%B9%E8%B1%A1/" style="font-size: 1.15em; color: rgb(147, 44, 104)">对象</a><a href="/my-gitee-blog/tags/%E6%97%A5%E6%9C%9F%E6%97%B6%E9%97%B4/" style="font-size: 1.15em; color: rgb(61, 109, 105)">日期时间</a><a href="/my-gitee-blog/tags/%E5%89%8D%E7%AB%AF%E6%8D%A2%E8%82%A4/" style="font-size: 1.15em; color: rgb(129, 37, 138)">前端换肤</a><a href="/my-gitee-blog/tags/VS-Code/" style="font-size: 1.15em; color: rgb(182, 44, 109)">VS Code</a><a href="/my-gitee-blog/tags/%E6%8F%92%E4%BB%B6/" style="font-size: 1.15em; color: rgb(185, 167, 74)">插件</a><a href="/my-gitee-blog/tags/%E6%8A%80%E5%B7%A7/" style="font-size: 1.34em; color: rgb(156, 121, 190)">技巧</a><a href="/my-gitee-blog/tags/%E5%B9%B4%E5%BA%A6%E6%80%BB%E7%BB%93/" style="font-size: 1.15em; color: rgb(164, 197, 123)">年度总结</a><a href="/my-gitee-blog/tags/%E5%AE%A1%E7%BE%8E/" style="font-size: 1.3em; color: rgb(119, 147, 61)">审美</a><a href="/my-gitee-blog/tags/%E6%91%84%E5%BD%B1/" style="font-size: 1.3em; color: rgb(34, 96, 141)">摄影</a><a href="/my-gitee-blog/tags/Koa/" style="font-size: 1.19em; color: rgb(172, 178, 26)">Koa</a><a href="/my-gitee-blog/tags/%E6%BA%90%E7%A0%81/" style="font-size: 1.26em; color: rgb(149, 185, 16)">源码</a><a href="/my-gitee-blog/tags/CLI/" style="font-size: 1.15em; color: rgb(90, 47, 155)">CLI</a><a href="/my-gitee-blog/tags/Vue-devtools/" style="font-size: 1.15em; color: rgb(19, 146, 106)">Vue-devtools</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/my-gitee-blog/archives/2022/07/"><span class="card-archive-list-date">七月 2022</span><span class="card-archive-list-count">5</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/my-gitee-blog/archives/2022/04/"><span class="card-archive-list-date">四月 2022</span><span class="card-archive-list-count">8</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/my-gitee-blog/archives/2022/01/"><span class="card-archive-list-date">一月 2022</span><span class="card-archive-list-count">4</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/my-gitee-blog/archives/2021/10/"><span class="card-archive-list-date">十月 2021</span><span class="card-archive-list-count">15</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/my-gitee-blog/archives/2021/09/"><span class="card-archive-list-date">九月 2021</span><span class="card-archive-list-count">23</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">55</div></div><div class="webinfo-item"><div class="item-name">已运行时间 :</div><div class="item-count" id="runtimeshow" data-publishDate="2021-09-06T16:00:00.000Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总字数 :</div><div class="item-count">95.5k</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2022-07-15T01:29:34.711Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('/my-gitee-blog/img/%E5%A4%A7%E5%9C%B0%E7%90%83%E8%83%8C%E6%99%AF.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2022 By Vixcity</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div id="running-time"></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="translateLink" type="button" title="简繁转换">简</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/my-gitee-blog/js/utils.js"></script><script src="/my-gitee-blog/js/main.js"></script><script src="/my-gitee-blog/js/tw_cn.js"></script><script src="/my-gitee-blog/js/search/local-search.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>function subtitleType () {
  getScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js').then(() => {
    jinrishici.load(function (result) {
      if (true) {
        var sub = "今日事&#44;今日毕,Never put off till tomorrow what you can do today,黑发不知勤学早&#44;白首方悔读书迟,凡是可以用 JavaScript 来写的应用&#44;最终都会用 JavaScript 来写。——Atwood定律".length == 0 ? new Array() : "今日事&#44;今日毕,Never put off till tomorrow what you can do today,黑发不知勤学早&#44;白首方悔读书迟,凡是可以用 JavaScript 来写的应用&#44;最终都会用 JavaScript 来写。——Atwood定律".split(',')
        var content = result.data.content
        var both = sub.unshift(content)
        var typed = new Typed('#subtitle', {
          strings: sub,
          startDelay: 300,
          typeSpeed: 150,
          loop: true,
          backSpeed: 50,
        })
      } else {
        document.getElementById('subtitle').innerHTML = result.data.content
      }
    })
  })
}

if (true) {
  if (typeof Typed === 'function') {
    subtitleType()
  } else {
    getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js').then(subtitleType)
  }
} else {
  subtitleType()
}
</script></div><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="/my-gitee-blog/js/newStyle.js"></script><script src="/my-gitee-blog/js/sakura.js"></script><script>setInterval(()=>{let create_time=Math.round(new Date("2021-9-8-00:00:00").getTime()/1000);let timestamp=Math.round((new Date().getTime()+8*60*60*1000)/1000);let second=timestamp-create_time;let time=new Array(0,0,0,0,0);if(second>=365*24*3600){time[0]=parseInt(second/(365*24*3600));second%=365*24*3600}if(second>=24*3600){time[1]=parseInt(second/(24*3600));second%=24*3600}if(second>=3600){time[2]=parseInt(second/3600);second%=3600}if(second>=60){time[3]=parseInt(second/60);second%=60}if(second>0){time[4]=second}currentTimeHtml='小博客已经安全运行 '+time[0]+' 年 '+time[1]+' 天 '+time[2]+' 时 '+time[3]+' 分 '+time[4]+' 秒';var elementById=document.getElementById('running-time');if(elementById){elementById.innerHTML=currentTimeHtml}},1000);</script><script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script><script src="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-card-history/baiduhistory/js/main.js"></script><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js"></script><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-nest.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><!-- hexo injector body_end start --><script data-pjax>function electric_clock_injector_config(){
                var parent_div_git = document.getElementsByClassName('sticky_layout')[0];
                var item_html = '<div class="card-widget card-clock"><div class="card-glass"><div class="card-background"><div class="card-content"><div id="hexo_electric_clock"><img id="card-clock-loading" src="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-clock/clock/images/weather/loading.gif" style="height: 120px; width: 100%;" data-ll-status="loading" class="entered loading"></div></div></div></div></div>';
                console.log('已挂载electric_clock')
                // parent_div_git.innerHTML=item_html+parent_div_git.innerHTML // 无报错，但不影响使用(支持pjax跳转)
                parent_div_git.insertAdjacentHTML("afterbegin",item_html) // 有报错，但不影响使用(支持pjax跳转)
            }if( document.getElementsByClassName('sticky_layout')[0] && (location.pathname ==='all'|| 'all' ==='all')){

            electric_clock_injector_config()
        } </script><script src="https://pv.sohu.com/cityjson?ie=utf-8"></script><script data-pjax  src="https://cdn.jsdelivr.net/gh/Zfour/hexo-electric-clock@1.0.6/clock.js"></script><div class="js-pjax"><script async="async">var arr = document.getElementsByClassName('recent-post-item');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '1s');
    arr[i].setAttribute('data-wow-delay', '0.5s');
    arr[i].setAttribute('data-wow-offset', '100');
    arr[i].setAttribute('data-wow-iteration', '1');
  }</script><script async="async">var arr = document.getElementsByClassName('card-widget');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script></div><script defer src="https://unpkg.zhimg.com/hexo-butterfly-wowjs/lib/wow.min.js"></script><script defer src="https://unpkg.zhimg.com/hexo-butterfly-wowjs/lib/wow_init.js"></script><!-- hexo injector body_end end --><script src="/my-gitee-blog/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body></html>